s
<template>
  <div class="dialog" v-show="visible">
    <div class="dialog-wrap">
      <div class="dialog-header">
        <slot name="header"></slot>
        <span @click="closeBtn">x</span>
      </div>
      <div class="dialog-body">
        <slot name="body"></slot>
      </div>
      <div class="dialog-footer">
        <slot name="footer"></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Dialog',
  data() {
    return {
      isShow: false,
    }
  },
  props: ['visible'],
  methods: {
    closeBtn() {
      this.$emit('update:visible', false)
    },
  },
}
</script>

<style lang="less" scoped>
.dialog {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  .dialog-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 460px;
    height: 260px;
    background-color: #fff;
    transform: translate(-50%, -50%);
    .dialog-header {
      margin: 10px 0 0 10px;
      font-size: 18px;
      span {
        position: absolute;
        top: 3px;
        right: 10px;
        cursor: pointer;
      }
    }
    .dialog-body {
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 17px;
      height: 70%;
    }
    .dialog-footer {
      position: absolute;
      bottom: 18px;
      right: 20px;
    }
  }
}
</style>
